import request from '@/router/axios';

export const getList = (current, size, params) => {
  return request({
    url: '/api/celery-address/open-address/list',
    method: 'get',
    params: {
      ...params,
      current,
      size,
    }
  })
}

export const getListByMemberIds = (memberIds) => {
  return request({
    url: '/api/celery-address/open-address/list-by-member-ids',
    method: 'get',
    params: {
      memberIds,
    }
  })
}

export const getSelect = (memberId) => {
  return request({
    url: '/api/celery-address/open-address/select',
    method: 'get',
    params: {
      memberId,
    }
  })
}

export const getSelectPublic = () => {
  return request({
    url: '/api/celery-address/open-address/select-public',
    method: 'get',
    params: {}
  })
}

export const getDetail = (id) => {
  return request({
    url: '/api/celery-address/open-address/detail',
    method: 'get',
    params: {
      id
    }
  })
}

export const remove = (ids) => {
  return request({
    url: '/api/celery-address/open-address/remove',
    method: 'post',
    params: {
      ids,
    }
  })
}

export const add = (row) => {
  return request({
    url: '/api/celery-address/open-address/submit',
    method: 'post',
    data: row
  })
}

export const update = (row) => {
  return request({
    url: '/api/celery-address/open-address/submit',
    method: 'post',
    data: row
  })
}

export const updateCode = () => {
  return request({
    url: '/api/celery-address/open-address/update-code',
    method: 'post',
  })
}

export const memberWeekAddress = (memberId, date) => {
  return request({
    url: '/api/celery-address/open-address/member-week-address',
    method: 'get',
    params: {
      memberId,
      date
    }
  })
}

